package co.yixiang.modules.shop.service.impl;

import co.yixiang.modules.shop.entity.YxSales;
import co.yixiang.modules.shop.entity.YxSalesManage;
import co.yixiang.modules.shop.mapper.YxSalesManageMapper;
import co.yixiang.modules.shop.mapping.YxSalesManageMap;
import co.yixiang.modules.shop.service.YxSalesManageService;
import co.yixiang.modules.shop.web.param.YxSalesManageQueryParam;
import co.yixiang.modules.shop.web.vo.YxSalesManageQueryVo;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.web.vo.Paging;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.beans.factory.annotation.Autowired;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
import java.util.List;


/**
 * <p>
 * 主管业务员表 服务实现类
 * </p>
 *
 * @author hisen
 * @since 2020-07-31
 */
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class YxSalesManageServiceImpl extends BaseServiceImpl<YxSalesManageMapper, YxSalesManage> implements YxSalesManageService {

    @Autowired
    private YxSalesManageMapper yxSalesManageMapper;
    @Autowired
    private YxSalesManageMap yxSalesManageMap;


    @Override
    public YxSalesManageQueryVo getYxSalesManageById(Serializable id){
        return yxSalesManageMapper.getYxSalesManageById(id);
    }

    @Override
    public Paging<YxSalesManageQueryVo> getYxSalesManagePageList(YxSalesManageQueryParam yxSalesManageQueryParam){
        Page page = setPageParam(yxSalesManageQueryParam,OrderItem.desc("create_time"));
        IPage<YxSalesManageQueryVo> iPage = yxSalesManageMapper.getYxSalesManagePageList(page,yxSalesManageQueryParam);
        return new Paging(iPage);
    }

    @Override
    public List<YxSalesManageQueryVo> getListByManagerId(int managerId){
        return yxSalesManageMapper.getListByManagerId(managerId);

    }

    @Override
    public List<YxSalesManageQueryVo> getAllSales(){
        return yxSalesManageMapper.getAllSales();
    }

}
